import Main from '@/views/Main.vue';

function load(name) {
    return function () {
        return import(`@/views/${name}.vue`)
    }
}

const fixedRoutes = [{
        path: '/',
        name: 'home',
        component: Main,
    },
    {
        path: '/about',
        name: 'about',
        component: () => import( /* webpackChunkName: "about" */ '@/views/About.vue')
    },
    {
        path: '/login',
        name: 'login',
        component: load('Login')
    },
    {
        path: '/main',
        name: 'main',
        component: Main
    },
]

export const otherRoutes = [
    {
        path: '/test',
        name: 'main',
        meta: {
            title: '首页'
        },
        component: Main,
        children: [{
            path: 'aa',
            name: 'aa',
            meta: {
                title: '首页',
                icon: 'home'
            },
            component: load('Home')
        }]
    },
    {
        path: '/system',
        name: 'system',
        meta: {
            title: '系统管理',
            icon: 'pie-chart'
        },
        component: Main,
        children: [{
                path: 'user',
                name: 'user',
                meta: {
                    title: '用户管理',
                },
                component: load('User')
            },
            {
                path: 'groups',
                name: 'groups',
                meta: {
                    title: '组管理'
                },
                component: load('Group')
            },
            {
                path: 'menus',
                name: 'menus',
                meta: {
                    title: '菜单管理'
                },
                component: load('Menu')
            },
        ]
    }
]

export default [
    ...fixedRoutes,
    ...otherRoutes
]